package com.it.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.it.dao.AdminUsersDao;
import com.it.domain.AdminUsers;
import com.it.domain.Employee_salary;
import com.it.service.AdminUsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("AdminUsersService")
public class AdminUsersServiceImpl implements AdminUsersService {
    @Autowired
    private AdminUsersDao adminUsersDao;

    /**
     * 登录
     * @param adminUsers
     * @return
     */
    @Override
    public List<AdminUsers> UserLogin(AdminUsers adminUsers) {
        return adminUsersDao.UserLogin(adminUsers);
    }

    /**
     * 注册
     * @param adminUsers
     */
    @Override
    public void UserRegist(AdminUsers adminUsers) {
        adminUsersDao.UserRegist(adminUsers);
    }
    /**
     * 查询所有
     * @return
     */
    @Override
    public List<AdminUsers> FindAll(int page,int size ) {
        PageHelper.startPage(page,size);
        return adminUsersDao.FindAll();
    }
    /**
     * 根据id查询用户
     * @param id
     * @return
     */
    @Override
    public List<AdminUsers> FindById(int id) {
        return adminUsersDao.FindById(id);
    }

    /**
     * 根据id修改user
     * @param adminUsers
     */
    @Override
    public void changeById(AdminUsers adminUsers) {
        adminUsersDao.changeById(adminUsers);
    }

    /**.
     * 根据id删除user
     * @param id
     */
    @Override
    public void deleById(int id) {
        adminUsersDao.deleById(id);
    }

    /**
     * 根据名称模糊查询
     * @param name
     * @return
     */
    @Override
    public List<AdminUsers> findByName(String name,int page,int size) {
        PageHelper.startPage(page,size);
        return adminUsersDao.findByName(name);
    }

    /**
     * 在salary中插入
     * @param employee_salary
     */
    @Override
    public void insertSalary(Employee_salary employee_salary) {
        adminUsersDao.insertSalary(employee_salary);
    }

    /**
     * 查询salary
     * @return
     */
    @Override
    public List<Employee_salary> FindAllSalary(int page,int size) {
        PageHelper.startPage(page,size);
        return adminUsersDao.FindAllSalary();
    }

    /**
     * 根据姓名模糊查询salary
     * @param name
     * @return
     */
    @Override
    public List<Employee_salary> FindAllSalaryByName(String name,int page,int size) {
        PageHelper.startPage(page,size);
        return adminUsersDao.FindAllSalaryByName(name);
    }


}
